/*
 * @lc app=leetcode.cn id=560 lang=typescript
 *
 * [560] 和为 K 的子数组
 */

// @lc code=start
function subarraySum(nums: number[], k: number): number {
    let res = 0;
    for (let i = 0; i < nums.length; i++) {
        let sum = 0;
        for (let q = i; q >= 0; --q) {
            sum += nums[q]
            if (sum === k) {
                res++;
            }
        }
    }

    // console.log(res)
    return res;
};

// subarraySum([1, -1, 0], 0)
// @lc code=end

